   <div id="error">
   <?php
    echo @$this->session->flashdata('error_title');
    ?>
</div>
<script language="javascript">
    // apply filters
        var applyFilter = jQuery(document).ready(function(){
        jQuery("#list").jqGrid({
            url: '<?php echo site_url() ?>/mailinterno/dataheader/',
            mtype: 'POST',
            datatype: 'json',
            colNames:['ID','Fecha Mail','Tipo','Mail CNT','Usuario'],
         colModel :[
                {name:'IdHether', index:'IdHether', width:2,hidden:true},
                {name:'Fecha', index:'Fecha', width:20},
                {name:'Tipo', index:'Tipo', width:20},
                {name:'CantidaMail', index:'CantidaMail', width:30,search:true, stype:'text'},
                {name:'Usuario', index:'Usuario', width:30,search:true, stype:'text'}
                ],
            pager: jQuery('#pager'),
            hiddengrid: true,
            sortname: 'IdHether',
            rowNum:50,
            rowList:[50,100,150],
            sortorder: "DESC",
            height: '100%',
            width: '510',
            imgpath: _base_url + 'public/css/jqgrid/flex/images',
            viewrecords: true,
            multiselect: false,
            onSelectRow: function(ids)
            {
            	if(ids != null)
            	{
            		var rec = jQuery("#list").getRowData(ids);
            		lol=ids;

            		jQuery("#list_etapas").setGridParam({url : _site_url + '/mailinterno/datadetalles', page : 1, mtype:'POST',postData:{iddetalle:rec.IdHether}}).setCaption("").trigger('reloadGrid');

            	}
            },
            adjacents: 4,
            jsonReader: { repeatitems : false, id_etapa: "0" }
        })


        .navGrid('#pager',{edit:false,add:false,del:false,search:false})


        .navButtonAdd('#pager',{caption:"", buttonimg: _base_url + "public/css/jqgrid/flex/images/text_columns.png", onClickButton:
        function()
        {
         jQuery("#list").setColumns();
        } })




        $('#apply_filter').bind('click', applyFilter);


    });

        var flAuto = true;
        var timeoutHnd;

        function doSearch(ev)
        {
              if(!flAuto) return;
              // var elem = ev.target||ev.srcElement;
              if(timeoutHnd)
                  clearTimeout(timeoutHnd);
                  timeoutHnd = setTimeout(gridReload,500);
        }

        function enableAutosubmit(state)
        {
              flAuto = state;
              jQuery("#submitButton").attr("disabled",state);
        }

        function gridReload()
        {
      	         var ba_mask = jQuery("#search_ba").val();
                 var ct_mask = jQuery("#search_ct").val();
                 var cd_mask = jQuery("#search_cd").val();

                  var array_search = cd_mask+'_'+ct_mask+'_'+ba_mask;

              jQuery("#list").setGridParam({url :'<?php echo site_url() ?>/CompanyEntrega/data/'+array_search, page : 1}).trigger('reloadGrid');
        }


    applyFilter.filterToolbar();

        function getCheckedValue(radioObj)
         {
      	   if(!radioObj)
		       return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

</script>

<div class="table_container">


<table>
<tr><td><div id="titulo">Mail Control Interno</div></td></tr>
<tr>



<tr>
<td>
    <table id="list" class="scroll"></table>
    <div id="pager" class="scroll" style="text-align:center;"></div>
</td>
 </tr>

<?php $this->load->view('detalle_mailci'); ?>
</table>
</div>